﻿using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace Assets.Scripts.ProceduralCityGenerator
{
	// Token: 0x02000342 RID: 834
	public class CityDestructionManager : MonoBehaviour
	{
		// Token: 0x060015AE RID: 5550 RVA: 0x0008D568 File Offset: 0x0008B768
		public void RegisterBuilding(CityBuilding building)
		{
			this.mTrackingBuildings.Add(building);
			if (this.mTrackingBuildings.Count > 1)
			{
				this.mTrackingBuildings.First<CityBuilding>().Collapse();
				this.mTrackingBuildings.RemoveAt(0);
			}
			if (this.CityManager != null)
			{
				this.CityManager.RemoveBuilding(building);
			}
		}

		// Token: 0x060015AF RID: 5551 RVA: 0x0008D5CB File Offset: 0x0008B7CB
		public void UnregisterBuilding(CityBuilding building)
		{
			this.mTrackingBuildings.Remove(building);
		}

		// Token: 0x0400186D RID: 6253
		private readonly IList<CityBuilding> mTrackingBuildings = new List<CityBuilding>();

		// Token: 0x0400186E RID: 6254
		private const int cTreshHold = 1;

		// Token: 0x0400186F RID: 6255
		public CityPopulationManager CityManager;
	}
}
